package com.ruoyi.web.controller.school;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.school.domain.PacInternship;
import com.ruoyi.school.service.PacInternshipService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/*
 * @Author Lin
 * @Description 实习相关接口
 * @Date 2025/6/4
 */
@Api("实习/见习相关接口")
@RestController
@RequestMapping("/school/internship")
public class PacInternshipController extends BaseController {
    @Resource
    private PacInternshipService internshipService;

    @ApiOperation("实习/见习列表")
    @GetMapping("/list")
    public TableDataInfo list(PacInternship pacInternship) {
        startPage();
        List<PacInternship> list = internshipService.getList(pacInternship);
        return getDataTable(list);
    }

    @GetMapping("/details")
    public AjaxResult details(PacInternship pacInternship) {
        PacInternship details = internshipService.getDetails(pacInternship);
        return success(details);
    }

    @Log(title = "实习/见习", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody PacInternship pacInternship) {
        boolean add = internshipService.add(pacInternship);
        return success(add);
    }

    @Log(title = "实习/见习", businessType = BusinessType.UPDATE)
    @PutMapping("/update")
    public AjaxResult update(@RequestBody PacInternship pacInternship) {
        boolean update = internshipService.edit(pacInternship);
        return success(update);
    }

    @Log(title = "实习/见习", businessType = BusinessType.DELETE)
    @DeleteMapping("/delete")
    public AjaxResult delete(PacInternship pacInternship) {
        boolean delete = internshipService.delete(pacInternship);
        return success(delete);
    }
}
